package com.example.demo.controller.req;

import com.example.demo.controller.exception.BizException;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.util.StringUtils;

@EqualsAndHashCode(callSuper = true)
@Data
public class OperationStatInsertReq extends BaseRequest {

    /**
     * "wood" "tea"
     * 类似于物品标签
     */
    private String type;

    /**
     * 2 3
     * 类似于物品计数
     */
    private Integer number;

    @Override
    public void validate() {
        super.validate();
        if (StringUtils.isEmpty(type)) {
            throw new BizException("物品名称不正确");
        }
        if (number == null || number < 0) {
            throw new BizException("物品数量不正确");
        }
    }
}
